'''
Created on 2010-11-5

@author: yun_hua
'''

class ParamFactory(object):
    """
    Parameter factory. Maybe it becomes an abstract factory.
    """
    
    def __init__(self):
        self.moleWeightIndex = 0
        self.desityIndex = 1
        self.cpIndex = 2
        self.hxIndex = 3
        self.stioIndex = 4
        self.volumeRateIndex = 5
        self.moleRateIndex = 6
    
    def get_actenergy(self):
        """
        Get the activation energy in J/Mol
        """
        return 75362.
    
    def get_t0(self): 
        """
        Get the inlet temperature in K. It may distributed uniformly in the inlet border.
        """
        return 312.
    
    def get_t0base(self):
        """
        Get the base temperature in K for the rate law calculation.
        """
        return 300
    
    def get_t0wall(self):
        """
        Get the cooling jacket's temperature.
        """
        return 273.15
    
    def get_k0(self):
        """
        Get the k0 in 1/hour -> 1/second for the rate law calculation.
        """
        return 1.28 / 3600
    
    def get_ke(self):
        """
        Get the thermal conductivity (W/m/K) of the reaction mixture.
        """
        return 0.599
    
    def get_uht(self):
        """
        Get the overall heat transfer coefficient (W/m**2/K) between the reactor and its surroundings.
        """
        return 1300. 
    
    def get_de(self):
        """
        Get the diffusivity of the reactor mixture in m**2/s of
        """
        return 1e-9
    
    def get_componentprop(self):
        """
        Get the reaction components' property dictionary, including 
        the mole weight(kg/Mol), 
        the density(kg/m**3),
        the heat capacity(J/Mol/K),
        the heat of formation(J/Mol),
        the stoichiometry and 
        the volume rate(m**3/s)
        """
        #self.prop = {'A-PropyleneOxide':[58.095 / 1000., 830., 146.54, -154911.6, 1., (46.62 / 35.3147 / 3600)], 
        #        'B-Water':[18. / 1000., 1000., 75.36, -286098., 1., (233.1 / 35.3147 / 3600)], 
        #        'M-Methanol':[32.042 / 1000., 791.3, 81.095, 0., 1., (46.62 / 35.3147 / 3600)], 
        #        'C-PropyleneGlycol':[76.095 / 1000., 1040., 192.59, -525676., 1., 0.]}
        self.prop = {'A-PropyleneOxide':[58.095 / 1000., 830., 146.54, -154911.6, 1., (4.07365e-5 / 3.5 / 2)], 
                'B-Water':[18. / 1000., 1000., 75.36, -286098., 1., (4.07365e-5 / 3.5 * 2.5)], 
                'M-Methanol':[32.042 / 1000., 791.3, 81.095, 0., 1., (4.07365e-5 / 3.5 / 2)], 
                'C-PropyleneGlycol':[76.095 / 1000., 1040., 192.59, -525676., 1., 0.]}
        for item in self.prop.values():
            item.append(item[self.volumeRateIndex] * item[self.desityIndex] / item[self.moleWeightIndex])
        
        return self.prop
    